
	<?php
	 ?>
	 <script>
		jQuery(document).ready(function($){

			$('#etalage').etalage({
				thumb_image_width: 300,
				thumb_image_height: 400,
				source_image_width: 900,
				source_image_height: 1200,
				show_hint: true,
				click_callback: function(image_anchor, instance_id){
					alert('Callback example:\nYou clicked on an image with the anchor: "'+image_anchor+'"\n(in Etalage instance: "'+instance_id+'")');
				}
			});
			// This is for the dropdown list example:
			$('.dropdownlist').change(function(){
				etalage_show( $(this).find('option:selected').attr('class') );
			});

		});
	</script>
	<script type="text/javascript">
			function DropDown(el) {
				this.dd = el;
				this.initEvents();
			}
			DropDown.prototype = {
				initEvents : function() {
					var obj = this;

					obj.dd.on('click', function(event){
						$(this).toggleClass('active');
						event.stopPropagation();
					});	
				}
			}

			$(function() {

				var dd = new DropDown( $('#dd') );

				$(document).click(function() {
					// all dropdowns
					$('.wrapper-dropdown-2').removeClass('active');
				});

			});

		</script>
		<?php
        $parentid = $this->Mitq_category->getParentidById($catid);
        $parentid= $parentid['parentid'];

        function findrt($listcategory,$parentid=0){
            $myarr = '';
            if($parentid==0){
                return 0;
            }else{
                foreach($listcategory as $key=> $value){
                    if($parentid==$value['id']){
                        $myarr.=$value['id'].'/';
                        $myarr.=findrt($listcategory,$value['parentid']);
                        break;
                    }
                }
                return $myarr;
            }
        }
        $myarr = findrt($listcategoryProduct,$infoproduct['categoryid']);
        $myarr  = explode('/',$myarr);
        
        foreach ($myarr as $key => $value) {
        	$breatcame[$key] = $this->model_frontend->getCategoryByID($value);
        }
        foreach ($breatcame as $key => $value) {
        	if(!empty($breatcame[$key]['alias'])){
        	$breatcame[$key]['link'] = $value['alias'].'-'.$value['type_category'].'-'.$value['id'].'.html';
        	}else{
        		$breatcame[$key]['link']='#';
        		$breatcame[$key]['title']='Trang Chủ';
        	}
        }
        sort($breatcame);
        ?>

<div class="content">
    	<div class="content_top">
    		<div class="breadcrumb">
    		<ul>
            <?php foreach($breatcame as $key=>$value){
            ?>
            <li itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
                <a rel="nofollow" href="<?php echo $value['link']?>" title="<?php echo $value['title']?>" itemprop="url"> <span itemprop="title"> <?php echo $value['title']?> </span></a>
            </li>
            <li class="spacebar">»</li>
            <?php }?>
    	    </div>
    	    <!-- breadcrumb -->
    		<div class="clear"></div>
    	</div>
    	<div class="section group">
			<div class="cont-desc span_1_of_2">
			  <div class="product-details">				
				<div class="grid images_3_of_2">
					<div id="container">
					   <div id="products_example">
						   <div id="products">
								<ul id="etalage">
									<?php if (!empty($imagesproduct)) { foreach ($imagesproduct as $key => $value) {?>
									<li>
										<a href="optionallink.html">
											<img class="etalage_thumb_image" src="<?php echo $value['url']?>" />
											<img class="etalage_source_image" src="<?php echo $value['url']?>" title="This is an optional description." />
										</a>
									</li>
									<?php	}	}	?>
								</ul>
							</div>
						</div>
					</div>
				</div>
				<div class="desc span_3_of_2">
					<h2><?php echo $infoproduct['title'];?></h2>
					<p><?php echo !empty($infoproduct['description'])?$infoproduct['description']:'';?></p>					
					<div class="price">
						<p>Giá mới: <span><?php echo number_format($infoproduct['price']);?>đ</span></p>
						<p>Giá cũ: <span style="text-decoration: line-through; font-size:16px"><?php echo number_format($infoproduct['priceold']);?></span>đ</p>
					</div>
					<div class="share-desc">
						<div class="share">
							<p>Số lượt ngó qua :<?php echo number_format($countViewProduct);?></p>
							<ul>
						    	<li><a href="#"><img src="public/template/frontend/images/facebook.png" alt=""></a></li>
						    	<li><a href="#"><img src="public/template/frontend/images/twitter.png" alt=""></a></li>					    
				    		</ul>
						</div>
						<div class="button"><span><a href="them-vao-gio-hang/<?php echo $infoproduct['alias'].'/'.$infoproduct['id']?>.html">Add to Cart</a></span></div>
						<div class="clear"></div>
					</div>
					 <div class="wish-list">
					 	<ul>
					 		<li class="wish"><a href="#">Add to Wishlist</a></li>
					 	    <li class="compare"><a href="#">Add to Compare</a></li>
					 	</ul>
					 </div>
				</div>
				<div class="rightsidebar span_3_of_1">
					<h2>Danh mục sản phẩm</h2>
					<ul>
						<?php if(!empty($listcategoryProduct)){foreach ($listcategoryProduct as $key => $value) {?>
						<li><a href="<?php echo $value['link'];?>"> <?php echo $value['title']?></a></li>
						<?php    }		}	?>
					</ul>
					<h2>Danh mục Tin Tức</h2>
					<ul>
						<?php if(!empty($listcategoryNote)){foreach ($listcategoryNote as $key => $value) {?>
						<li><a href="<?php echo $value['link'];?>"> <?php echo $value['title']?></a></li>
						<?php    }		}	?>
					</ul>
					</div>
				<div class="clear"></div>
		  	</div>
			<div class="product_desc">	
				<div class="resp-tabs-container">
					<h2 class="resp-accordion resp-tab-active" role="tab" aria-controls="tab_item-0"><span class="resp-arrow"></span>Product Details</h2>
					<?php echo !empty($infoproduct['content'])?$infoproduct['content']:'';?>
			    </div>	
				  <div class="your-review">
				  	 <h3>How Do You Rate This Product?</h3>
				  	  <p>Write Your Own Review?</p>
				  	  <form>
					    	<div>
						    	<span><label>Nickname<span class="red">*</span></label></span>
						    	<span><input type="text" value=""></span>
						    </div>
						    <div><span><label>Summary of Your Review<span class="red">*</span></label></span>
						    	<span><input type="text" value=""></span>
						    </div>						
						    <div>
						    	<span><label>Review<span class="red">*</span></label></span>
						    	<span><textarea> </textarea></span>
						    </div>
						   <div>
						   		<span><input type="submit" value="SUBMIT REVIEW"></span>
						  </div>
					    </form>
				  	 </div>				
				</div>
			</div>
		 </div>
	 </div>
	    <script type="text/javascript">
    $(document).ready(function () {
        $('#horizontalTab').easyResponsiveTabs({
            type: 'default', //Types: default, vertical, accordion           
            width: 'auto', //auto or any width like 600px
            fit: true   // 100% fit in a container
        });
    });
   </script>		
   
 	</div>
 	